How to slide like a pro?¶

# This plot is not interactive
data = np.random.randn(2, 100)
fig, ax = plt.subplots()
ax.scatter(*data, c=data[1], s=100*np.abs(data[0]));

How to display interactive charts?¶

  • Use plotly !
  • If the chart below does not display on slides after rendering, try to run the cell below to force javascript injection of plotly inside your notebook JSON.
# Only pyplot can easily make a graph interactive in notebook AND slides
import plotly.express as px
df = px.data.gapminder()
fig = px.scatter(df.query("year==2007"), x="gdpPercap", y="lifeExp", size="pop", color="continent",
           hover_name="country", log_x=True, size_max=60)
fig.show()
import plotly.express as px
df = px.data.gapminder()
fig = px.line(outcome, title = "Financial impact of removal of sellers", 
              labels=dict(value= "Olist Profit", index = "Number of dropped sellers"))
fig.add_hline(y = start_profit, annotation_text = "Current Olist Profit")
fig.add_vline(x= 376, annotation_text = "no of sellers with neg. Olist Profit",
             annotation_position="left")
fig.update_layout(showlegend = False)
fig.show()

How to Remove inputs?¶

The following fragment 👇 should only show the dataframe output because the cell "tag" is set to "remove_input"

lift benefit
0 0.01 20000.0
1 0.02 40000.0
2 0.03 60000.0
3 0.04 80000.0

How to Remove outputs?¶

The following fragment 👇 should only show the cell input because the cell "tag" is set to "remove_output"

# Show this but not the result
1+1